﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using Mbl.ParameterizedTest.AcceptanceTests.CalculatorTests;

namespace Mbl.ParameterizedTest.AcceptanceTests.EnumerableTests
{
    [TestClass]
    public class ContainsTests
    {
        [TestMethod]
        [ExpectedFailedTestCases(2, 3)]
        public void Assertion_can_be_made_based_on_enumerable_content()
        {
            ParameterizedTest
                .For((string s) => (IEnumerable<char>)s)
                .Given("asdf").ExpectContains('a').Because("It's correct")                
                .Given("asdf").ExpectContains('x').Because("It's wrong")
                .Given("asdf").ExpectContains('A').Because("It's wrong")
                .Evaluate();
        }

        [TestMethod]
        [ExpectedFailedTestCases(4)]
        public void Contains_multiple_values_in_any_order()
        {
            ParameterizedTest
                .For((string s) => (IEnumerable<char>)s)
                .Given("asdf").ExpectContains('a', 's').Because("It's correct")
                .Given("asdf").ExpectContains('f', 'a').Because("It's correct")
                .Given("asdf").ExpectContains('a', 'd', 's', 'f').Because("It's correct")
                .Given("asdf").ExpectContains('a', 'd', 's', 'x').Because("It's wrong")
                .Evaluate();
        }

        [TestMethod]
        [ExpectedFailedTestCases(3)]
        public void Assertion_can_be_made_based_on_actual_return_type()
        {
            ParameterizedTest
                .For((string s) => (IEnumerable<char>)s)
                .Given("asdf").ExpectContainsAny('a', 'q').Because("It's correct")
                .Given("asdf").ExpectContainsAny('q', 'f').Because("It's correct")
                .Given("asdf").ExpectContainsAny('x', 'y').Because("It's wrong")                
                .Evaluate();
        }
    }
}
